package com.wiscamp.ninechapters.tags.infrastructure.converters;

import com.wiscamp.ninechapters.tags.domain.models.KnowledgePoint;
import com.wiscamp.ninechapters.tags.domain.models.KnowledgePointRelation;
import com.wiscamp.ninechapters.tags.infrastructure.po.KnowledgePointPO;
import com.wiscamp.ninechapters.tags.infrastructure.po.KnowledgePointRelationPO;
import com.wiscamp.ninechapters.tags.infrastructure.po.KnowledgePointView;
import jakarta.validation.constraints.NotNull;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface KnowledgePointConverter {
    KnowledgePointConverter Instance = Mappers.getMapper(KnowledgePointConverter.class);

    // knowledge point
    KnowledgePoint toKnowledgePoint(@NotNull KnowledgePointPO po);

    KnowledgePoint toKnowledgePointByView(@NotNull KnowledgePointView view);

    KnowledgePointPO toKnowledgePointPO(@NotNull KnowledgePoint entity);

    KnowledgePointPO toKnowledgePointPO(@NotNull KnowledgePoint entity, @NotNull @MappingTarget KnowledgePointPO po);
    // endregion

    // relation
    KnowledgePointRelation toKnowledgePointRelation(@NotNull KnowledgePointRelationPO po);

    KnowledgePointRelationPO toKnowledgePointRelationPO(@NotNull KnowledgePointRelation entity);

    KnowledgePointRelationPO toKnowledgePointRelationPO(@NotNull KnowledgePointRelation entity, @NotNull @MappingTarget KnowledgePointRelationPO po);
    // endregion



}
